/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.adama.entite;

import fr.adama.entite.modele.ModelePaie;
import fr.adama.entite.typePerso.EtatBulletin;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.UniqueConstraint;
import org.hibernate.search.annotations.Analyzer;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;

/**
 *
 * @author mini-john
 */
@Entity
@Table(uniqueConstraints = @UniqueConstraint(name = "BULLETINEXIST", columnNames = {"contrat_id", "periode"}))
@Indexed
@Analyzer(impl = org.apache.lucene.analysis.standard.StandardAnalyzer.class)
public class BulletinPaie implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "bulletinPaie_sequence")
    @SequenceGenerator(name = "bulletinPaie_sequence", sequenceName = "bulletinPaie_sequence")
    private Long id;

    @OneToOne(fetch = FetchType.LAZY)
    private ModelePaie modelPaie;
    private BigDecimal chargeSalarial;
    private BigDecimal chargePatronale;
    private BigDecimal aDeduire;
    private BigDecimal aPayer;
    private BigDecimal salaireImposable;
    private BigDecimal salaireNetAPayer;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date periode;
    private Integer mois;
    private Integer annee;
    @ManyToOne
    @IndexedEmbedded
    private Contrat contrat;
    private String pathToPdf;
    @Field()
    private String numero;
    @Enumerated(EnumType.STRING)
    private EtatBulletin etatBulletin;

   
   
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public ModelePaie getModelPaie() {
        return modelPaie;
    }

    public void setModelPaie(ModelePaie modelPaie) {
        this.modelPaie = modelPaie;
    }

    public BigDecimal getChargeSalarial() {
        return chargeSalarial;
    }

    public void setChargeSalarial(BigDecimal chargeSalarial) {
        this.chargeSalarial = chargeSalarial;
    }

    public BigDecimal getChargePatronale() {
        return chargePatronale;
    }

    public void setChargePatronale(BigDecimal chargePatronale) {
        this.chargePatronale = chargePatronale;
    }

    public BigDecimal getaDeduire() {
        return aDeduire;
    }

    public void setaDeduire(BigDecimal aDeduire) {
        this.aDeduire = aDeduire;
    }

    public BigDecimal getaPayer() {
        return aPayer;
    }

    public void setaPayer(BigDecimal aPayer) {
        this.aPayer = aPayer;
    }

    public BigDecimal getSalaireImposable() {
        return salaireImposable;
    }

    public void setSalaireImposable(BigDecimal salaireImposable) {
        this.salaireImposable = salaireImposable;
    }

    public BigDecimal getSalaireNetAPayer() {
        return salaireNetAPayer;
    }

    public void setSalaireNetAPayer(BigDecimal salaireNetAPayer) {
        this.salaireNetAPayer = salaireNetAPayer;
    }

    public Contrat getContrat() {
        return contrat;
    }

    public void setContrat(Contrat contrat) {
        this.contrat = contrat;
    }

  

    public Date getPeriode() {
        return periode;
    }

    public void setPeriode(Date periode) {
        this.periode = periode;
    }

    public Integer getMois() {
        return mois;
    }

    public void setMois(Integer mois) {
        this.mois = mois;
    }

    public Integer getAnnee() {
        return annee;
    }

    public void setAnnee(Integer annee) {
        this.annee = annee;
    }

    public String getPathToPdf() {
        return pathToPdf;
    }

    public void setPathToPdf(String pathToPdf) {
        this.pathToPdf = pathToPdf;
    }

    public EtatBulletin getEtatBulletin() {
        return etatBulletin;
    }

    public void setEtatBulletin(EtatBulletin etatBulletin) {
        this.etatBulletin = etatBulletin;
    }

    public String getNumero() {
        return numero;
    }

    public void setNumero(String numero) {
        this.numero = numero;
    }

   
    

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BulletinPaie)) {
            return false;
        }
        BulletinPaie other = (BulletinPaie) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.adama.entite.BulletinPaie[ id=" + id + " ]";
    }

}
